using System;
using LambdaGp.Core;

namespace LambdaGp.Operators.Functions.MathFunctions
{
    public class Frac : UnaryFunction
    {
        public Frac()
            : base("frac")
        {
        }

        protected override Func<double> CompileUnaryToFunc(Individual individual, Func<double> argument)
        {
            return
                () =>
                {
                    double val = argument();
                    return val - Math.Floor(val);
                };
        }
    }
}
